import React from 'react';
import PropTypes from 'prop-types';
import Todo from './Todo';

var TodoList = function TodoList(_ref) {
  var todos = _ref.todos,
      onTodoClick = _ref.onTodoClick;
  return React.createElement(
    'ul',
    null,
    todos.map(function (todo) {
      return React.createElement(Todo, Object.assign({ key: todo.id }, todo, { onClick: function onClick() {
          return onTodoClick(todo.id);
        } }));
    })
  );
};

TodoList.propTypes = {
  todos: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.number.isRequired,
    completed: PropTypes.bool.isRequired,
    text: PropTypes.string.isRequired
  }).isRequired).isRequired,
  onTodoClick: PropTypes.func.isRequired
};

export default TodoList;